import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;

import org.junit.Test;

public class HelloWorld {
	// IDE 快捷键
	// main
	public static void main(String[] args) {
		// syso
		System.out.println("HelloWorld");
		
		User user = new User();
		// user.id = 888;
		user.setId(1);
		user.setName("张三");
		user.setAge(23);
		
		int id = user.getId();
		String name = user.getName();
		int age = user.getAge();
		
		System.out.println("id:" + id);
		System.out.println("name:" + name);
		System.out.println("age:" + age);
	}
	
	@Test
	public void test() {
		// 数组缺点是长度固定
		User[] array = new User[5];
		ArrayList<User> list = new ArrayList<>();
		Scanner scanner = new Scanner(System.in);
		
		while (true) {
			// 每执行一次循环创建一个User对象
			System.out.println("请输入用户id：");
			int id = scanner.nextInt();
			System.out.println("请输入用户名: ");
			String name = scanner.next();
			System.out.println("请输入用户年龄：");
			int age = scanner.nextInt();
			User user = new User();
			user.setId(id);
			user.setName(name);
			user.setAge(age);
			System.out.println(user);
			
			// 把创建好的user对象放到ArrayList
			list.add(user);
			
			System.out.println("您是否要退出？ 0 退出 ");
			int quit = scanner.nextInt();
			if (quit == 0) {
				System.out.println("退出用户输入");
				break;
			}
		}
		
		for (User user : list) {
			System.out.println(user);
		}
		
		System.out.println("请选择要进行的操作：");
		System.out.println("1、根据id查找");
		System.out.println("2、根据名字查找");
		System.out.println("3、根据年龄查找");
		int type = scanner.nextInt();
		
		if (type == 1) {
			
		} else if (type == 2) {
			
		} else if (type == 3) {
			
		} else if (type == 10) {
			
		}
		
		switch (type) {
		case 1:
			
			break;
		case 2:
			
			break;
		case 3:
			
			break;	
		default:
			break;
		}
		
		System.out.println("end");
	}
}
